using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DevExpress.ExpressApp.DC;
using DevExpress.Persistent.Base;
using DevExpress.Persistent.BaseImpl;
using DevExpress.Xpo;
using DevExpress.Persistent.Validation;
namespace Ascent.QiPei.Module.BusinessObjects.Purchase
{
  public partial class PurchasingOrderItems : DevExpress.Persistent.BaseImpl.BaseObject
  {
    private System.Int32 _quantity;
    private System.Int16 _discountPercent;
    private System.Single _totalAmount;
    private System.String _remarks;
    private System.Single _amount;
    private System.Single _discountAmount;
    private System.Single _unitPrice;
    private Ascent.QiPei.Module.BusinessObjects.Purchase.PurchasingOrder _purchasingOrder;
    private Ascent.QiPei.Module.BusinessObjects.Base.Product _product;
    public PurchasingOrderItems(DevExpress.Xpo.Session session)
      : base(session)
    {
    }
    [DevExpress.ExpressApp.DC.XafDisplayNameAttribute("产品")]
    public Ascent.QiPei.Module.BusinessObjects.Base.Product Product
    {
      get
      {
        return _product;
      }
      set
      {
          SetPropertyValue("Product", ref _product, value);
        //if (_product == value)
        //  return;
        //Ascent.QiPei.Module.BusinessObjects.Base.Product prevProduct = _product;
        //_product = value;
        //if (IsLoading)
        //  return;
        //if (prevProduct != null && prevProduct.PurchasingOrderItems == this)
        //  prevProduct.PurchasingOrderItems = null;
        //if (_product != null)
        //  _product.PurchasingOrderItems = this;
        //OnChanged("Product");
      }
    }
    [DevExpress.Persistent.Base.DataSourcePropertyAttribute("折扣%")]
    [DevExpress.ExpressApp.DC.XafDisplayNameAttribute("折扣%")]
    [DevExpress.Persistent.Base.ImmediatePostDataAttribute]
    public System.Int16 DiscountPercent
    {
      get
      {
        return _discountPercent;
      }
      set
      {
        SetPropertyValue("DiscountPercent", ref _discountPercent, value);
      }
    }
    [DevExpress.ExpressApp.DC.XafDisplayNameAttribute("单价")]
    [RuleRequiredField(DefaultContexts.Save)]
    [DevExpress.Persistent.Base.ImmediatePostDataAttribute]
    public System.Single UnitPrice
    {
      get
      {
        return _unitPrice;
      }
      set
      {
        SetPropertyValue("UnitPrice", ref _unitPrice, value);
      }
    }
    [DevExpress.ExpressApp.DC.XafDisplayNameAttribute("数量")]
    [RuleRequiredField(DefaultContexts.Save)]
    [DevExpress.Persistent.Base.ImmediatePostDataAttribute]
    public System.Int32 Quantity
    {
      get
      {
        return _quantity;
      }
      set
      {
        SetPropertyValue("Quantity", ref _quantity, value);
      }
    }
    [DevExpress.Xpo.AssociationAttribute("PurchasingOrderItems-PurchasingOrder")]
    [System.ComponentModel.BrowsableAttribute(false)]
    public Ascent.QiPei.Module.BusinessObjects.Purchase.PurchasingOrder PurchasingOrder
    {
      get
      {
        return _purchasingOrder;
      }
      set
      {
        SetPropertyValue("PurchasingOrder", ref _purchasingOrder, value);
      }
    }
    [DevExpress.ExpressApp.DC.XafDisplayNameAttribute("备注")]
    public System.String Remarks
    {
      get
      {
        return _remarks;
      }
      set
      {
        SetPropertyValue("Remarks", ref _remarks, value);
      }
    }
    [DevExpress.Persistent.Base.ImmediatePostDataAttribute]
    [DevExpress.ExpressApp.DC.XafDisplayNameAttribute("合计金额")]
    public System.Single TotalAmount
    {
      get
      {
        return _totalAmount;
      }
      set
      {
        SetPropertyValue("TotalAmount", ref _totalAmount, value);
      }
    }
    [DevExpress.ExpressApp.DC.XafDisplayNameAttribute("折扣金额")]
    [DevExpress.Persistent.Base.ImmediatePostDataAttribute]
    public System.Single DiscountAmount
    {
      get
      {
        return _discountAmount;
      }
      set
      {
        SetPropertyValue("DiscountAmount", ref _discountAmount, value);
      }
    }
    [DevExpress.ExpressApp.DC.XafDisplayNameAttribute("实付金额")]
    [DevExpress.Persistent.Base.ImmediatePostDataAttribute]
    public System.Single Amount
    {
      get
      {
        return _amount;
      }
      set
      {
        SetPropertyValue("Amount", ref _amount, value);
      }
    }
  }
}
